import os
import shutil

from option import parse_args


def main():
    args = parse_args()
    crops = os.path.join(args.root_dir, 'crops')
    crops_multiple_actors = os.path.join(args.root_dir, 'crops_multiple_actors')
    lines = open('multiple_actors_statistics.dat').readlines()
    for line in lines:
        line_split = line.split(',')
        assert len(line_split) == 5

        ori_video_path = os.path.join(crops, line_split[1])
        ori_video_dst_path = os.path.join(crops_multiple_actors, line_split[1])
        if os.path.exists(ori_video_path) and not os.path.exists(ori_video_dst_path):
            shutil.move(ori_video_path, crops_multiple_actors)

        fake_video_path = os.path.join(crops, line_split[2])
        fake_video_dst_path = os.path.join(crops_multiple_actors, line_split[2])
        if os.path.exists(fake_video_path) and not os.path.exists(fake_video_dst_path):
            shutil.move(fake_video_path, crops_multiple_actors)


if __name__ == '__main__':
    main()
